#include <iostream>

using namespace std;

int main () {

    int D;
    cout << "Den: "; cin >> D;
    int M;
    cout << "Mesyac: "; cin >> M;
    switch (D) {
        case 28:
            if (M==2) cout << "D=1; M=3; \n";
            break;
        case 30:
            if ( (M==4) || (M==6) || (M==9) || (M==11) )
                    cout << "D=1; M=" << M+1 << ";\n";
            break;
        case 31:
            if (M!=12) cout << "D=1; M=" << M+1 << ";\n";
                    else  cout << "D=1; M=1; \n";
            break;
        default:
                cout << "D=" << D+1 << "; M=" << M << ";\n";
        break;
    }
}
